<?php
class Story_Model_DbTable_Bubbles extends Engine_Db_Table
{
	protected $_rowClass = 'Story_Model_Bubble';

	public function getBubbleSelect($params = array())
	{
		$select = $this->select();
	
		if (isset($params['photo_id'])) {
			$select->where("photo_id = ?", $params['photo_id']);
		}	
		
		return $select;
	}
	
	public function getBubbles($photo_id)
	{	
		if (empty($photo_id)) {
			return null;
		}
	
		$params = array('photo_id' => $photo_id);		
		$select = $this->getBubbleSelect($params);
	
		$items = $this->fetchAll($select); 
		$arr = array();
		foreach($items as $item){
			$arr[] = $item->toArrayEx();
		}
		
		return $arr;
	}
}